import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {
  WorkPlanExceptionForm,
  WorkPlanExceptionQuery,
  WorkPlanExceptionVO
} from '@/api/painting/workPlanException/types';

/**
 * 查询工作计划异常列表
 * @param query
 * @returns {*}
 */

export const listWorkPlanException = (query?: WorkPlanExceptionQuery): AxiosPromise<WorkPlanExceptionVO[]> => {
  return request({
    url: '/painting/workPlanException/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工作计划异常详细
 * @param id
 */
export const getWorkPlanException = (id: string | number): AxiosPromise<WorkPlanExceptionVO> => {
  return request({
    url: '/painting/workPlanException/' + id,
    method: 'get'
  });
};

/**
 * 新增工作计划异常
 * @param data
 */
export const addWorkPlanException = (data: WorkPlanExceptionForm) => {
  return request({
    url: '/painting/workPlanException',
    method: 'post',
    data: data
  });
};

/**
 * 修改工作计划异常
 * @param data
 */
export const updateWorkPlanException = (data: WorkPlanExceptionForm) => {
  return request({
    url: '/painting/workPlanException',
    method: 'put',
    data: data
  });
};

/**
 * 删除工作计划异常
 * @param id
 */
export const delWorkPlanException = (id: string | number | Array<string | number>) => {
  return request({
    url: '/painting/workPlanException/' + id,
    method: 'delete'
  });
};
